function checkTime(i) {
    if (i < 10) {
        i = '0' + i
    }
    return i
}
function checkDay(i) {
    switch (i) {
        case 1:
            i = '一'; break;
        case 2:
            i = '二'; break;
        case 3:
            i = '三'; break;
        case 4:
            i = '四'; break;
        case 5:
            i = '五'; break;
        case 6:
            i = '六'; break;
        case 7:
            i = '日'; break;
    }
    return i
}
var t = setTimeout(time, 1000);
var today_year = ''
function time() {
    clearTimeout(t);
    dt = new Date();
    var y = dt.getFullYear();
    var mt = dt.getMonth() + 1;
    var day = dt.getDate();
    var z = dt.getDay();
    var h = dt.getHours();
    var m = dt.getMinutes();
    var s = dt.getSeconds();
    document.querySelector(".nowTime").innerHTML = checkTime(h) + ":" + checkTime(m) + ':' + checkTime(s);
    document.querySelector(".nowYear").innerHTML = y + "-" + checkTime(mt) + "-" + checkTime(day);
    document.querySelector(".nowWeek").innerHTML = '星期' + checkDay(z);
    t = setTimeout(time, 1000);

}
time()


